ostree.git
10 years agotest-xattrs: sync how this is skipped with test-rofiles-fuse
Simon McVittie [Thu, 31 Mar 2016 16:47:36 +0000 (17:47 +0100)]
test-xattrs: sync how this is skipped with test-rofiles-fuse

If we touch test-xattrs before sourcing libtest.sh, we get:

test tmpdir=/tmp/test-tmp-ostree_test-xattrs.sh.test-HSEXEY is not
empty; run this test via `make check TESTS=`, not directly

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #234
Approved by: cgwalters

10 years agotest-abi: use G_TEST_SRCDIR, G_TEST_BUILDDIR
Simon McVittie [Thu, 31 Mar 2016 17:30:52 +0000 (18:30 +0100)]
test-abi: use G_TEST_SRCDIR, G_TEST_BUILDDIR

There's no need to invent new variables for these.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #234
Approved by: cgwalters

10 years agolibtest.sh: use G_TEST_SRCDIR, G_TEST_BUILDDIR to find resources
Simon McVittie [Thu, 31 Mar 2016 17:29:44 +0000 (18:29 +0100)]
libtest.sh: use G_TEST_SRCDIR, G_TEST_BUILDDIR to find resources

This fixes the bug that in installed-tests that run testlib.sh under
"bash -c" (i.e. the C and JS tests), $(dirname $0) is "." and we can't do
the LD_PRELOAD correctly:

ERROR: ld.so: object './libreaddir-rand.so' from LD_PRELOAD cannot be
preloaded (cannot open shared object file): ignored.

Similarly, those tests can't copy gpghome correctly.

This also removes the confusing situation that SRCDIR in libtest.sh
(which is ${top_srcdir}/tests) does not mean the same thing as SRCDIR
in test-abi.sh (which is just ${top_srcdir}).

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #234
Approved by: cgwalters

10 years agotests: Make failing to kill the GPG agent non-fatal
Colin Walters [Thu, 31 Mar 2016 17:46:16 +0000 (13:46 -0400)]
tests: Make failing to kill the GPG agent non-fatal

It's not working for me in `make check` on a RHEL 7 Workstation,
apparently because no GPG agent is spawned.  I'm guessing this has
something to do with the GPG version?

The downside of this is we will be less likely to notice if GPG
changes again and we start leaking agents like we're in The Matrix
Reloaded.  But the real solution to that is containers anyways.

Closes: #233
Approved by: smcv

10 years agoProbe for GNU parallel more accurately
Simon McVittie [Thu, 31 Mar 2016 13:32:55 +0000 (14:32 +0100)]
Probe for GNU parallel more accurately

moreutils parallel isn't compatible with the command-line syntax
used here. Because it doesn't implement GNU-style --help and exits 1
when that option is given, this test was correctly skipped when
using moreutils parallel, but only by mistake.

moreutils parallel might conceivably gain --help and --version in
future, but hopefully nothing incompatible with GNU parallel is going
to gain a --gnu option.

Also use the --gnu option to force the new command-line semantics;
some versions optionally supported an incompatible command-line syntax
taken from moreutils parallel.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #232
Approved by: cgwalters

10 years agobasic-test: commit with a non-empty subject
Jonathan Lebon [Thu, 31 Mar 2016 13:10:27 +0000 (14:10 +0100)]
basic-test: commit with a non-empty subject

[smcv: split out from a larger commit, part of PR #231; add commit message]
Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #232
Approved by: cgwalters

10 years agotest-pull-untrusted.sh: always corrupt a regular file, not a symlink
Jonathan Lebon [Thu, 31 Mar 2016 13:07:01 +0000 (14:07 +0100)]
test-pull-untrusted.sh: always corrupt a regular file, not a symlink

test-pull-untrusted.sh would pass when run as root, but fail when run
as testuser. It turned out that the way the files were stored in the
repo when running as a testuser were different, which meant that a
different .file object was chosen for corruption. Except that file
turned out to be a symlink, so the echo "broke" actually just wrote
to the no_such_file symlink target, thus keeping the actual symlink
file's checksum the same and causing the pull-local to pass when it
should have failed.

[smcv: split this out of a larger commit, part of PR #231]
Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #232
Approved by: cgwalters

10 years agoSkip tests that run rofiles-fuse if /dev/fuse or /etc/mtab unavailable
Simon McVittie [Thu, 31 Mar 2016 12:44:27 +0000 (13:44 +0100)]
Skip tests that run rofiles-fuse if /dev/fuse or /etc/mtab unavailable

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #232
Approved by: cgwalters

10 years agoForce libreaddir-rand to be a shared library
Simon McVittie [Thu, 31 Mar 2016 09:17:02 +0000 (10:17 +0100)]
Force libreaddir-rand to be a shared library

If installed-tests are disabled, it would normally be a static
(convenience) library, which isn't something we can LD_PRELOAD.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #232
Approved by: cgwalters

10 years agotests/admin-test.sh: this is a bash script, not a POSIX sh script
Simon McVittie [Thu, 31 Mar 2016 08:48:18 +0000 (09:48 +0100)]
tests/admin-test.sh: this is a bash script, not a POSIX sh script

The "function foo()" syntax is bash-specific, and Colin indicated in
PR #226 that he prefers to require bash rather than trying to support
every POSIX shell.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #232
Approved by: cgwalters

10 years agoLoad g-i bindings from builddir during build-time testing
Simon McVittie [Thu, 31 Mar 2016 08:02:23 +0000 (09:02 +0100)]
Load g-i bindings from builddir during build-time testing

Previously, the build-time tests would only pass if the g-i bindings to
OSTree were already installed, with a reasonably similar version.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #232
Approved by: cgwalters

10 years ago.gitignore: update
Simon McVittie [Thu, 31 Mar 2016 07:42:09 +0000 (08:42 +0100)]
.gitignore: update

Closes: #232
Approved by: cgwalters

10 years agoIn tests that use gpg, terminate the gpg-agent after testing
Simon McVittie [Thu, 31 Mar 2016 07:27:32 +0000 (08:27 +0100)]
In tests that use gpg, terminate the gpg-agent after testing

Otherwise we leak those processes.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #232
Approved by: cgwalters

10 years agotap-test: clean up temporary test directories as intended
Simon McVittie [Thu, 31 Mar 2016 07:24:56 +0000 (08:24 +0100)]
tap-test: clean up temporary test directories as intended

The script created ./.testtmp but looked for ./.test, which isn't
going to work.

This means the various "ostree trivial-httpd --autoexit" processes
actually exit, because their web roots are cleaned up now.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #232
Approved by: cgwalters

10 years agoSymlink libreaddir-rand.so into tests directory
Simon McVittie [Mon, 28 Mar 2016 12:46:23 +0000 (13:46 +0100)]
Symlink libreaddir-rand.so into tests directory

This means it can be LD_PRELOADed during build-time testing.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #232
Approved by: cgwalters

10 years agovarious tests: skip if temp directory lacks xattr support
Simon McVittie [Thu, 31 Mar 2016 10:06:05 +0000 (11:06 +0100)]
various tests: skip if temp directory lacks xattr support

Some autobuilder environments place the entire build chroot on tmpfs, so
even /var/tmp might not have this.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #232
Approved by: cgwalters

10 years agotest-xattrs: use TAP syntax to skip test
Simon McVittie [Mon, 28 Mar 2016 12:08:32 +0000 (13:08 +0100)]
test-xattrs: use TAP syntax to skip test

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #232
Approved by: cgwalters

10 years agodocs/CONTRIBUTING.md: Update for github move, Homu etc.
Colin Walters [Wed, 30 Mar 2016 13:19:38 +0000 (09:19 -0400)]
docs/CONTRIBUTING.md: Update for github move, Homu etc.

Closes: #230
Approved by: jlebon

10 years agocommit: support editor for orphan commits
Jonathan Lebon [Wed, 30 Mar 2016 03:27:19 +0000 (23:27 -0400)]
commit: support editor for orphan commits

This is a follow up to #227 to allow ostree to open the editor also for
orphan commits when no subject or body is given on the cmdline.

Closes: #229
Approved by: cgwalters

10 years agocommit: Support writing orphans
Colin Walters [Tue, 29 Mar 2016 14:53:50 +0000 (10:53 -0400)]
commit: Support writing orphans

The API supports this, and it's not hard for us to do in the command
line as well.  One possible use case is separating "content
generation" in a separate server.

Related: https://github.com/ostreedev/ostree/pull/223

Closes: #227
Approved by: jlebon

10 years agocommit: Support generating commits with no parent, or a custom one
Colin Walters [Fri, 25 Mar 2016 15:03:32 +0000 (11:03 -0400)]
commit: Support generating commits with no parent, or a custom one

When I'm doing local development builds, it's quite common for me not
to want to accumulate history.  There are also use cases for this on
build servers as well.

In particular, using this, one could write a build system that didn't
necessarily need to have access to (a copy of) the OSTree repository.
Instead, the build system would determine the last commit ID on the
branch, and pass that to a worker node, then sync the generated
content back.

The API supported generating custom commits that don't necessarily
reference the previous commit on the same branch, let's just expose
this in the command line for convenience.

I plan to also support this rpm-ostree.

Closes: #223
Approved by: jlebon

10 years agodocs: Add a section on repository management
Colin Walters [Fri, 25 Mar 2016 14:35:25 +0000 (10:35 -0400)]
docs: Add a section on repository management

Just keeping my promise to write more documentation.  There could be a
lot more to write here, but I'm trying to get a start done.

Closes: #222
Approved by: jlebon

10 years agopackaging: fix bashism in dist-snapshot target
Simon McVittie [Mon, 28 Mar 2016 11:25:17 +0000 (12:25 +0100)]
packaging: fix bashism in dist-snapshot target

On Debian and its derivatives, /bin/sh is a lightweight POSIX shell
(currently dash) which does not support the bash {foo,bar} syntax.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #226
Approved by: cgwalters

10 years agomain: Set log handler for OSTree domain
Dan Nicholson [Sat, 26 Mar 2016 15:35:30 +0000 (08:35 -0700)]
main: Set log handler for OSTree domain

Now that OSTree is used as G_LOG_DOMAIN, set the main handler to match
so the appropriate messages are filtered. It would probably be more
appropriate to spell out "OSTree" in the code, but since G_LOG_DOMAIN is
being defined globally in the project, might as well reuse it here.

https://bugzilla.gnome.org/show_bug.cgi?id=764237

Closes: #225
Approved by: cgwalters

10 years agobuild: Set G_LOG_DOMAIN to OSTree
Dan Nicholson [Sat, 26 Mar 2016 15:28:20 +0000 (08:28 -0700)]
build: Set G_LOG_DOMAIN to OSTree

This will allow ostree programs to filter log messages specifically for
OSTree instead of using the NULL domain for ostree debugging.

https://bugzilla.gnome.org/show_bug.cgi?id=764237

Closes: #225
Approved by: cgwalters

10 years agocore: Add debug messages for traversing
Dan Nicholson [Mon, 21 Mar 2016 22:55:19 +0000 (15:55 -0700)]
core: Add debug messages for traversing

If you have a repo where a needed object has been inadvertantly removed,
all you'll get is a "No such metadata object" error with no clue about
where it was referenced from.

Add some debug messages to provide clues about which objects are being
traversed and found.

https://bugzilla.gnome.org/show_bug.cgi?id=764006

Closes: #224
Approved by: cgwalters

10 years agocore: Add verbose messages for pruning
Dan Nicholson [Thu, 17 Mar 2016 18:39:39 +0000 (11:39 -0700)]
core: Add verbose messages for pruning

When prune fails, it can be really difficult to figure out why. This at
least lets you know which objects are being considered.

https://bugzilla.gnome.org/show_bug.cgi?id=764006

Closes: #224
Approved by: cgwalters

10 years agoOstreeSePolicy: add ostree_sepolicy_get_csum()
Jonathan Lebon [Wed, 23 Mar 2016 19:54:49 +0000 (15:54 -0400)]
OstreeSePolicy: add ostree_sepolicy_get_csum()

This can be used as a fingerprint to determine whether two
OstreeSePolicy objects are equivalent.

Also add documentation for ostree_sepolicy_get_name().

Closes: #219
Approved by: cgwalters

10 years agoAdd --untrusted option to pull and pull-local
Alexander Larsson [Wed, 23 Mar 2016 11:32:03 +0000 (12:32 +0100)]
Add --untrusted option to pull and pull-local

https://bugzilla.gnome.org/show_bug.cgi?id=764125

Closes: #221
Approved by: cgwalters

10 years agopull: Add OSTREE_REPO_PULL_FLAGS_UNTRUSTED flag
Alexander Larsson [Wed, 23 Mar 2016 10:47:44 +0000 (11:47 +0100)]
pull: Add OSTREE_REPO_PULL_FLAGS_UNTRUSTED flag

If this is set we verify all objects we pull, even for local remotes,
and we avoid hard-linking into local source repos.

https://bugzilla.gnome.org/show_bug.cgi?id=764125

Closes: #221
Approved by: cgwalters

10 years agotests: Add a test-abi
Colin Walters [Wed, 23 Mar 2016 19:18:27 +0000 (15:18 -0400)]
tests: Add a test-abi

This would have caught a potential ABI regression in
https://bugzilla.gnome.org/show_bug.cgi?id=764056
(If we ran this test while building `--without-libarchive`)

Pull request: #218
Approved by: jlebon

10 years agoMerge pull request #220 from cgwalters/travis-stub
Jonathan Lebon [Thu, 24 Mar 2016 15:49:41 +0000 (11:49 -0400)]
Merge pull request #220 from cgwalters/travis-stub

Add a stub .travis.yml

10 years agoAdd a stub .travis.yml
Colin Walters [Thu, 24 Mar 2016 15:45:10 +0000 (11:45 -0400)]
Add a stub .travis.yml

This is at the moment just so that we can use Homu.  In the future I'd
like to make travis just one of multiple PR testers we use.

10 years agoRelease 2016.4
Colin Walters [Wed, 23 Mar 2016 19:39:15 +0000 (15:39 -0400)]
Release 2016.4

10 years agotraverse: Require variant when traversing dirtree
Dan Nicholson [Wed, 23 Mar 2016 16:32:29 +0000 (09:32 -0700)]
traverse: Require variant when traversing dirtree

The dirtree object is required for traversing, so don't use the
load_variant_if_exists() function. This will return a
G_IO_ERROR_NOT_FOUND to the caller rather than trying to ref a NULL
variant in ostree_repo_commit_traverse_iter_init_dirtree() if the object
is missing.

https://bugzilla.gnome.org/show_bug.cgi?id=764091

10 years agotests: Add a commitpartial + prune test
Colin Walters [Wed, 23 Mar 2016 19:32:06 +0000 (15:32 -0400)]
tests: Add a commitpartial + prune test

Followup for previous commit.

10 years agoprune: Don't fail on partial commits
Dan Nicholson [Wed, 23 Mar 2016 16:47:51 +0000 (09:47 -0700)]
prune: Don't fail on partial commits

If a commit only pull has been done, then the commit object exists in
the object store in addition to the commitpartial file. Traversing this
partial commit will likely fail, but that's expected. If traverse
returns a G_IO_ERROR_NOT_FOUND in this case, continue with pruning.

https://bugzilla.gnome.org/show_bug.cgi?id=764091

10 years agopull local: Don't import objects we already have
Alexander Larsson [Wed, 23 Mar 2016 08:28:17 +0000 (09:28 +0100)]
pull local: Don't import objects we already have

In particular, I noticed this because the pull failed when trying to
pull from a shallow repo which only had the new objects that was
needed.

https://bugzilla.gnome.org/show_bug.cgi?id=764059

10 years agoFix building without libarchive
Stef Walter [Wed, 23 Mar 2016 08:30:34 +0000 (09:30 +0100)]
Fix building without libarchive

Although libarchive is an optional build option, the build
fails without it.

https://bugzilla.gnome.org/show_bug.cgi?id=764056

10 years agoadmin: Add an `unlock` command, and libostree API
Colin Walters [Fri, 18 Mar 2016 19:32:58 +0000 (15:32 -0400)]
admin: Add an `unlock` command, and libostree API

I'm trying to improve the developer experience on OSTree-managed
systems, and I had an epiphany the other day - there's no reason we
have to be absolutely against mutating the current rootfs live.  The
key should be making it easy to rollback/reset to a known good state.

I see this command as useful for two related but distinct workflows:

 - `ostree admin unlock` will assume you're doing "development".  The
   semantics hare are that we mount an overlayfs on `/usr`, but the
   overlay data is in `/var/tmp`, and is thus discarded on reboot.
 - `ostree admin unlock --hotfix` first clones your current deployment,
   then creates an overlayfs over `/usr` persistent
   to this deployment.  Persistent in that now the initramfs switchroot
   tool knows how to mount it as well.  In this model, if you want
   to discard the hotfix, at the moment you roll back/reboot into
   the clone.

Note originally, I tried using `rofiles-fuse` over `/usr` for this,
but then everything immediately explodes because the default (at least
CentOS 7) SELinux policy denies tons of things (including `sshd_t`
access to `fusefs_t`).  Sigh.

So the switch to `overlayfs` came after experimentation.  It still
seems to have some issues...specifically `unix_chkpwd` is broken,
possibly because it's setuid?  Basically I can't ssh in anymore.

But I *can* `rpm -Uvh strace.rpm` which is handy.

NOTE: I haven't tested the hotfix path fully yet, specifically
the initramfs bits.

10 years agolibglnx porting: Use glnx_opendirat()
Colin Walters [Fri, 18 Mar 2016 21:17:54 +0000 (17:17 -0400)]
libglnx porting: Use glnx_opendirat()

This unfortunately adds *more* `gs_file_get_path_cached()`, but we'll
fix that all in one go.

10 years agolibglnx porting: Use glnx_shutil_rm_rf_at()
Colin Walters [Fri, 18 Mar 2016 20:59:59 +0000 (16:59 -0400)]
libglnx porting: Use glnx_shutil_rm_rf_at()

In some cases (such as `ostree-sysroot-cleanup.c`), the surrounding
code would be substantially cleaner if it was also ported to
fd-relative, but I'm going to do that in a separate patch.

That way these patches are easier to review for mechanical
correctness.  I used an Emacs keyboard macro as the poor man's
[Coccinelle](http://coccinelle.lip6.fr/).

10 years agolibglnx porting: Use glnx_set_error_from_errno
Colin Walters [Fri, 18 Mar 2016 20:52:10 +0000 (16:52 -0400)]
libglnx porting: Use glnx_set_error_from_errno

:warning: There is a notable spiked pit trap here around
`posix_fallocate()` and `errno`.  This has bit other projects,
see e.g.
https://github.com/systemd/systemd/commit/7bb87460e691d30c1a7fd23a1a8240776957e05f

Otherwise the port was straightforward.

10 years agoUse GSubprocess instead of GSSubprocess (libgsystem removal)
Colin Walters [Fri, 18 Mar 2016 20:46:42 +0000 (16:46 -0400)]
Use GSubprocess instead of GSSubprocess (libgsystem removal)

Since we hard-depend on GLib 2.40, we can start using GSubprocess.
This is part of dropping our dependency on libgsystem, which is
deprecated in favor of libglnx (as well as migrating things to GLib).

10 years agoadmin-switch: Add missing reboot argument
Colin Walters [Wed, 23 Mar 2016 13:42:17 +0000 (09:42 -0400)]
admin-switch: Add missing reboot argument

Spotted by jlebon in https://github.com/GNOME/ostree/pull/211

10 years agotest-libarchive: fix underlinking
Simon McVittie [Fri, 11 Mar 2016 08:46:27 +0000 (08:46 +0000)]
test-libarchive: fix underlinking

Signed-off-by: Simon McVittie <smcv@debian.org>
10 years agoSkip test_libarchive_ignore_device_file if we cannot write xattrs
Simon McVittie [Fri, 11 Mar 2016 09:09:48 +0000 (09:09 +0000)]
Skip test_libarchive_ignore_device_file if we cannot write xattrs

The test tries to get a filesystem that supports xattrs by writing
to /var/tmp, but in some automated build environments the entire
build chroot is on a tmpfs.

Signed-off-by: Simon McVittie <smcv@debian.org>
10 years agotests/admin-test.sh: add #!/bin/sh
Simon McVittie [Sat, 19 Mar 2016 17:54:38 +0000 (17:54 +0000)]
tests/admin-test.sh: add #!/bin/sh

This is executable and appears to be intended to be executed directly,
so it should have a #! line.

10 years agomkdocs: Fix the site name
Colin Walters [Mon, 21 Mar 2016 16:53:40 +0000 (12:53 -0400)]
mkdocs: Fix the site name

10 years agodeploy: Handle a read-only /boot
Colin Walters [Mon, 21 Mar 2016 14:37:38 +0000 (10:37 -0400)]
deploy: Handle a read-only /boot

I'd like to encourage people to make OSTree-managed systems more
strictly read-only in multiple places.  Ideally everywhere is
read-only normally besides `/var/`, `/tmp/`, and `/run`.

`/boot` is a good example of something to make readonly.  Particularly
now that there's work on the `admin unlock` verb, we need to protect
the system better against things like `rpm -Uvh kernel.rpm` because
the RPM-packaged kernel won't understand how to do OSTree right.

In order to make this work of course, we *do* need to remount `/boot`
as writable when we're doing an upgrade that changes the kernel
configuration.  So the strategy is to detect whether it's read-only,
and if so, temporarily mount read-write, then remount read-only when
the upgrade is done.

We can generalize this in the future to also do `/etc` (and possibly
`/sysroot/ostree/` although that gets tricky).

One detail: In order to detect "is this path a mountpoint" is
nontrivial - I looked at copying the systemd code, but the right place
is to use `libmount` anyways.

10 years agomanual: Migrate related projects wiki page into manual
Colin Walters [Thu, 17 Mar 2016 01:39:06 +0000 (21:39 -0400)]
manual: Migrate related projects wiki page into manual

This content currently lives here:
<https://wiki.gnome.org/Projects/OSTree/RelatedProjects>.  Moving it
into the manual in Markdown:

 - Makes it look better
 - It's more useful alongside the rest of the docs
 - Is much less crummy in general than the GNOME wiki

10 years agoDon't fail "ostree remote refs" if writing the summary cache is not permitted
Alexander Larsson [Fri, 18 Mar 2016 09:00:58 +0000 (10:00 +0100)]
Don't fail "ostree remote refs" if writing the summary cache is not permitted

It used to be allowed to run something like "ostree remote refs" on
a read-only (e.g. system) repo. However, the summary cache caused that to
break. This commit just makes it not save the cache if we get some kind
of permission error when writing it. It'll still work, even without the
cache.

https://bugzilla.gnome.org/show_bug.cgi?id=763855

10 years agolibglnx porting: gs_transfer_out_value -> g_steal_pointer
Colin Walters [Thu, 17 Mar 2016 15:22:25 +0000 (11:22 -0400)]
libglnx porting: gs_transfer_out_value -> g_steal_pointer

It's a bit more verbose but...eh.

10 years agolibglnx porting: xattr calls
Colin Walters [Thu, 17 Mar 2016 15:02:48 +0000 (11:02 -0400)]
libglnx porting: xattr calls

These are straightforward as the libgsystem versions were already just
equivalent shims.

10 years agolibglnx porting: gs_free -> g_autofree
Colin Walters [Thu, 17 Mar 2016 14:19:12 +0000 (10:19 -0400)]
libglnx porting: gs_free -> g_autofree

There were surprisingly few uses left.

10 years agolibglnx porting: gs_fd_close -> glnx_fd_close
Colin Walters [Thu, 17 Mar 2016 14:17:47 +0000 (10:17 -0400)]
libglnx porting: gs_fd_close -> glnx_fd_close

I'd like to eventually kill libgsystem.

10 years agotests: Strengthen test tmpdir sanity check, be compat with ginsttest saving
Colin Walters [Fri, 18 Mar 2016 12:43:53 +0000 (08:43 -0400)]
tests: Strengthen test tmpdir sanity check, be compat with ginsttest saving

GNOME Continuous uses ginstest-runner --report-directory, which causes
the tests to save their tmpdirs persistently.  This also means the
result directories didn't match the `/(var/)?tmp` regexp, which broke
the ostree tests in GContinuous.

Fix this by simply asserting that the tmpdir either has `.tmpdir` or
nothing.

10 years agocontrib/golang: Initial golang bindings
Colin Walters [Fri, 19 Feb 2016 20:52:49 +0000 (15:52 -0500)]
contrib/golang: Initial golang bindings

We were considering using this for Docker integration, but we may end
up going a different architectural path.  Anyways, it doesn't hurt to
have the bindings in here - they can do a few things.

I decided to fork some of the core code from
https://github.com/dradtke/gotk3 because...well, what we really need a
GIR-based core generator but I didn't want to start on the fully
correct thing until we knew we wanted it, and this was a quick hack.

Also, let's make a `contrib/` directory for things like this.

10 years agodocs: Add a section on writing buildsystems
Colin Walters [Fri, 4 Mar 2016 02:17:53 +0000 (21:17 -0500)]
docs: Add a section on writing buildsystems

And add a test that is a demo buildsystem.

10 years agodocs: Cleanup Markdown
Micah Abbott [Wed, 16 Mar 2016 19:02:18 +0000 (15:02 -0400)]
docs: Cleanup Markdown

I was going through the new version of the docs and noticed a few
problems.  Mostly URLs that aren't linked, extra whitespace, and a few
mis-spellings.

I ran the files through `aspell check` and made some manual changes
myself.

These changes were tested locally with `mkdocs serve`

10 years agorofiles-fuse: Fix permission comparison
Alexander Larsson [Tue, 15 Mar 2016 12:18:35 +0000 (13:18 +0100)]
rofiles-fuse: Fix permission comparison

We want to allow write if the devinode is in the set,
not the other way around.

https://bugzilla.gnome.org/show_bug.cgi?id=763676

10 years agorepo: Fix the skip-summary-if-summary.sig-is-same cache
Alexander Larsson [Tue, 15 Mar 2016 11:04:43 +0000 (12:04 +0100)]
repo: Fix the skip-summary-if-summary.sig-is-same cache

This code was always downloading the summary even for a cache hit due
to a missing else.

10 years agotests: add test for summary file caching
Giuseppe Scrivano [Fri, 11 Mar 2016 12:04:54 +0000 (13:04 +0100)]
tests: add test for summary file caching

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoprune: delete all cached summaries files
Giuseppe Scrivano [Fri, 11 Mar 2016 11:59:18 +0000 (12:59 +0100)]
prune: delete all cached summaries files

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agorepo: use the skip summary download optimization for repo_remote_fetch_summary
Giuseppe Scrivano [Fri, 11 Mar 2016 12:16:04 +0000 (13:16 +0100)]
repo: use the skip summary download optimization for repo_remote_fetch_summary

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agopull: cache summary and summary.sig
Giuseppe Scrivano [Fri, 11 Mar 2016 11:39:32 +0000 (12:39 +0100)]
pull: cache summary and summary.sig

It allows an optimization to skip the download of the summary file
if its .sig file is unchanged.

Downloading the .sig file is much cheaper than downloading the summary
file from repositories with many branches.

https://bugzilla.gnome.org/show_bug.cgi?id=762973

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agolibotutil: new function ot_openat_ignore_enoent
Giuseppe Scrivano [Fri, 11 Mar 2016 10:36:21 +0000 (11:36 +0100)]
libotutil: new function ot_openat_ignore_enoent

Refactor some common code

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agodocs: Reference the git docs on references
Colin Walters [Wed, 9 Mar 2016 19:07:52 +0000 (14:07 -0500)]
docs: Reference the git docs on references

10 years agobuild: Don't install test data without --enable-installed-tests
Colin Walters [Tue, 8 Mar 2016 18:12:00 +0000 (13:12 -0500)]
build: Don't install test data without --enable-installed-tests

Otherwise $(installed_testdir) is empty so we try to put content in
`/`, which I noticed when trying to build an RPM (it works works fine
`sudo make install`).

10 years agotests/basic: Fix race in timestamp test
Colin Walters [Fri, 4 Mar 2016 15:53:47 +0000 (10:53 -0500)]
tests/basic: Fix race in timestamp test

%Z only uses seconds, so it's possible that we did the commit
in the same second, which made this test racy.

- Switch to full nanosecond precision using '%.Y' so it always differs
- Fix the inverted `cmp` usage
- Add a missing `ok`

10 years agolib: Add ostree_sysroot_load_if_changed() API
Colin Walters [Thu, 3 Mar 2016 18:49:54 +0000 (13:49 -0500)]
lib: Add ostree_sysroot_load_if_changed() API

This will allow daemons like rpm-ostree to detect if there are any new
deployments efficiently, in combination with using inotify.  If there
are any changes, rpm-ostree wants publish them on DBus.

While we're here, add some changes to start doing unit C testing of
the sysroot API.

10 years agotests: Unify some tmpdir code, add ability for C to use libtest.sh
Colin Walters [Wed, 2 Mar 2016 15:05:08 +0000 (10:05 -0500)]
tests: Unify some tmpdir code, add ability for C to use libtest.sh

I want to be able to easily test the C API on actual data in an OSTree
repo.  The shell `libtest.sh` has code to generate it.  Bridge the two
worlds by introducing a little `libostreetest` library which has a C
API which spawns a shell that runs things in `libtest.sh`.

Yes, this is about as beautiful as it sounds, which is to say, it's
not.  But it works!

Note while we were here, I realized we were actually now creating
*two* tmpdirs per test in `make check` because the tap driver was
already doing that.  Unify it so we know the C code can rely on it.

10 years agotests: More TAP fixups
Colin Walters [Thu, 3 Mar 2016 23:00:54 +0000 (18:00 -0500)]
tests: More TAP fixups

Hopefully getting closer now.

10 years agolib: Add ostree_sysroot_init_osname() API, bump mtime
Colin Walters [Thu, 3 Mar 2016 16:39:33 +0000 (11:39 -0500)]
lib: Add ostree_sysroot_init_osname() API, bump mtime

And change the command line to use it.  rpm-ostree had a copy
of this code, and thus there's a clear reason to have an API.

While we're moving this into API, ensure the mtime on deploy is bumped
after an osname is created, so that daemons like rpm-ostree can notice
changes.  (In reality, creating the directory should do this, but
let's be double sure)

10 years agodocs/introduction: Note VMs vs baremetal
Colin Walters [Thu, 3 Mar 2016 19:20:44 +0000 (14:20 -0500)]
docs/introduction: Note VMs vs baremetal

10 years agotests: Convert two more exit 77 instances into TAP-compatible SKIP
Colin Walters [Thu, 3 Mar 2016 19:19:10 +0000 (14:19 -0500)]
tests: Convert two more exit 77 instances into TAP-compatible SKIP

Followup to https://github.com/GNOME/ostree/pull/194

10 years agodeploy: Bump the mtime on ostree/deploy after deployments finish
Colin Walters [Wed, 2 Mar 2016 21:26:09 +0000 (16:26 -0500)]
deploy: Bump the mtime on ostree/deploy after deployments finish

This allows other processes (e.g. rpm-ostreed) to monitor for external
changes (e.g. if someone does `ostree admin undeploy`) in a relatively
sane fashion.

Specifically, I'm trying to fix:
https://github.com/projectatomic/rpm-ostree/issues/220

10 years agotests: Port to glib-tap.mk, make `make check` run all of the tests
Colin Walters [Wed, 2 Mar 2016 15:28:04 +0000 (10:28 -0500)]
tests: Port to glib-tap.mk, make `make check` run all of the tests

OSTree's code for testing predates the `glib-tap.mk` making its
way into GLib.  Let's switch to it, as it provides a number
of advantages.

By far the biggest advantage is that `make check` can start to run
most of the tests *in addition* to having them work installed.

This commit keeps the installed tests working, but `make check` turns
out to be really broken because...our TAP usage has bitrotted to say
the least.  Fix that all up.

Do some hacks so that the tests work uninstalled as well - in
particular, `glib-tap.mk` and the bits encoded into
`g_test_build_filename()` assume *recursive* Automake (blah).  Work
around that by creating a symlink when installed to loop back.

10 years agorefs: Add argument --list to print the full ref name
Giuseppe Scrivano [Wed, 2 Mar 2016 09:48:52 +0000 (10:48 +0100)]
refs: Add argument --list to print the full ref name

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agolibostree: Adjust `cleanup_ref_prefix` to use ostree_repo_list_refs_ext
Giuseppe Scrivano [Wed, 2 Mar 2016 09:14:23 +0000 (10:14 +0100)]
libostree: Adjust `cleanup_ref_prefix` to use ostree_repo_list_refs_ext

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agorefs: add tests
Giuseppe Scrivano [Mon, 29 Feb 2016 10:23:46 +0000 (11:23 +0100)]
refs: add tests

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agorefs: allow to specify multiple refs as args
Giuseppe Scrivano [Mon, 29 Feb 2016 10:14:59 +0000 (11:14 +0100)]
refs: allow to specify multiple refs as args

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoostree-repo: new public function `ostree_repo_list_refs_ext`
Giuseppe Scrivano [Wed, 2 Mar 2016 08:58:38 +0000 (09:58 +0100)]
ostree-repo: new public function `ostree_repo_list_refs_ext`

It accepts a `flags` argument to control its behavior.  Differently
from `ostree_repo_list_refs`, the `refspec_prefix` is not removed from
the results.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoAdd a missing #include to fix "make check"
Colin Walters [Wed, 2 Mar 2016 15:29:41 +0000 (10:29 -0500)]
Add a missing #include to fix "make check"

10 years agorepo: Add ostree_repo_get_dfd()
Colin Walters [Wed, 2 Mar 2016 02:52:22 +0000 (21:52 -0500)]
repo: Add ostree_repo_get_dfd()

I plan to use this in rpm-ostree at least for two reasons:
 - To find the mtime on the repo
 - To use the tmp/ directory to stage content (but we should eventually
   add a better API)

10 years agolib: Introduce versioned symbols
Colin Walters [Tue, 1 Mar 2016 22:42:59 +0000 (17:42 -0500)]
lib: Introduce versioned symbols

As rpm-ostree evolves, it keeps driving API additions to libostree.
This creates a relatively tight coupling.

However, if delivering via e.g. RPM, unless one manually remembers to
increment the `Requires:` in the spec file, it's possible for the two
to become desynchronized.

RPM handles versioned symbols and will ensure a dependency if the
application starts using a newer version.

To implement this, switch to `-fvisibility=hidden`, along with an
annotation in the header, and finally add a `.sym` file.

This matches what other projects like systemd and libvirt do.

Although rather than attempting to retroactively version symbols, glom
them all onto the current one.

10 years agotest-rofiles-fuse: skip when fusermount is not present
Giuseppe Scrivano [Mon, 29 Feb 2016 13:51:03 +0000 (14:51 +0100)]
test-rofiles-fuse: skip when fusermount is not present

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoFix make syntax-check
Giuseppe Scrivano [Mon, 29 Feb 2016 12:23:28 +0000 (13:23 +0100)]
Fix make syntax-check

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agodocs: Add a blurb on the summary file
Colin Walters [Sat, 27 Feb 2016 16:28:33 +0000 (11:28 -0500)]
docs: Add a blurb on the summary file

We expect people to use it now, so let's actually describe what it is.

10 years agoRelease 2016.3
Colin Walters [Fri, 26 Feb 2016 16:58:05 +0000 (11:58 -0500)]
Release 2016.3

10 years agodeltas: Add a compression size heuristic for endianness detection
Colin Walters [Thu, 25 Feb 2016 16:07:30 +0000 (11:07 -0500)]
deltas: Add a compression size heuristic for endianness detection

I see when analyzing a delta here that due to byteswapping a negative
compression ratio of 540%, 66%, and 28%.  Let's arbitrarily pick 20%
as a threshold for detecting byetswapping.

10 years agodeltas: Heuristically detect endianness for older deltas
Colin Walters [Wed, 24 Feb 2016 22:04:04 +0000 (17:04 -0500)]
deltas: Heuristically detect endianness for older deltas

If the average object size is greater than 4GiB, let's assume we're
dealing with opposite endianness.  I'm fairly confident no one is
going to be shipping peta- or exa- byte size ostree deltas, period.
Past the gigabyte scale you really want bittorrent or something.

10 years agodeltas: Use endianness marker when parsing
Colin Walters [Wed, 24 Feb 2016 19:29:56 +0000 (14:29 -0500)]
deltas: Use endianness marker when parsing

Extend the `static-delta show` and `pull` commands to use the
endianness information (if available).

10 years agodeltas: Include an endianness marker
Colin Walters [Tue, 23 Feb 2016 16:00:18 +0000 (11:00 -0500)]
deltas: Include an endianness marker

We screwed up and had delta integers use host endianness.  Start
digging out by at least annotating the endianness.

https://bugzilla.gnome.org/show_bug.cgi?id=762515

10 years agorofiles-fuse: Handle operations on the root
Alexander Larsson [Wed, 24 Feb 2016 11:14:38 +0000 (12:14 +0100)]
rofiles-fuse: Handle operations on the root

ENSURE_RELPATH breaks when path is "/". In that case we need
to return "." instead of "".

https://bugzilla.gnome.org/show_bug.cgi?id=762596

10 years agodeltas: Fix regression in ostree_repo_static_delta_execute_offline
Alexander Larsson [Wed, 24 Feb 2016 14:17:46 +0000 (15:17 +0100)]
deltas: Fix regression in ostree_repo_static_delta_execute_offline

xdg-app passed this a filename directly, and in this case it should be
used as is. This regressed to always look for "superblock" in the same
directory as the passed in filename.

https://bugzilla.gnome.org/show_bug.cgi?id=762617

10 years agodeltas: Fix some more 32 bit warnings
Colin Walters [Tue, 23 Feb 2016 03:07:02 +0000 (22:07 -0500)]
deltas: Fix some more 32 bit warnings

10 years agolib: Two more compiler warning fixes
Colin Walters [Tue, 23 Feb 2016 02:11:10 +0000 (21:11 -0500)]
lib: Two more compiler warning fixes

10 years agolibarchive: Fix a 32 bit format warning
Colin Walters [Tue, 23 Feb 2016 01:52:33 +0000 (20:52 -0500)]
libarchive: Fix a 32 bit format warning

This is actually an error by default with our default CFLAGS.

10 years agoRelease 2016.2
Colin Walters [Mon, 22 Feb 2016 23:08:01 +0000 (18:08 -0500)]
Release 2016.2